#ifndef _CONTROL_H_
#define _CONTROL_H_
#include <string>
#include "channel.h"
#include "opencv2/core/core.hpp"
#include "opencv2/contrib/contrib.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
#include <fstream>
#include <sstream>
using namespace cv;
using namespace std;


class Control
{
  public:
    Control();
    void processCommand(int argc, char* argv[]);
    static cv::Mat norm_0_255(cv::InputArray _src);
    static void read_csv(const string& filename, vector<Channel>& images,
			 vector<int>& types, vector<string>& names,
			 char separator = ';');
    void classification(std::string csv_train, std::string csv_test,
			std::string descriptor_train,
			std::string descriptor_test, std::string res_folder);
    void trainning(std::string csv_train, std::string csv_test,
		   std::string descriptor_train, std::string descriptor_test,
		   int nb_block);
    void predictNNC(Channel &image, const std::vector<Channel> &train_images,
		 std::vector<int> v,
		 const std::vector< std::vector<int> > &trains_v);
    void predictKNNC(Channel &image, const std::vector<Channel> &train_images,
		    std::vector<int> v,
		    const std::vector< std::vector<int> > &trains_v);

    double descriptorsDiff(const std::vector<int> &v1,
			   const std::vector<int> &v2);
    double cosinDistance(const std::vector<int> &v1, const std::vector<int> &v2);
};

struct Distance
{
    int index;
    double value;
};

bool funcCompare(Distance d1, Distance d2);

#endif /* _CONTROL_H_ */
